I'm trying to write code to write out the ID of all links to/from an object that are not in 2 different baselines. When I input them into a skip list, they are going in correctly, but when I try to get the values back, I am getting a 9-digit number. For example, I add "TCP_4470" to the skip list, but when I try to take this value out, I'm getting 357402608. I can't figure out why the value I'm outputting isn't the same as what I'm inputting. Here is the function I'm using:
Buffer getLinkDiffs(Object oOldObj, Object oNewObj) {
LinkRef lRef;
Link oLnk;
Buffer links;
string sObjID = "";
Object targetObj = null;
ModName_ targetMod;
Skip skOldLinks = createString;
Skip skNewLinks = createString;
//Put all links into their respective skip lists
for oLnk in all(oOldObj->"*") do {
targetMod = target oLnk;
read(fullName(targetMod), false);
targetObj = target(oLnk);
sObjID = identifier(targetObj);
put(skOldLinks, sObjID, sObjID);
}
for oLnk in all(oNewObj->"*") do {
targetMod = target oLnk;
read(fullName(targetMod), false);
targetObj = target(oLnk);
sObjID = identifier(targetObj);
put(skNewLinks, sObjID, sObjID);
}
//Now check for added and deleted links by comparing the skip lists
for sLink in skOldLinks do {
if (!find(skNewLinks, sLink)) {
links += sLink "\n";
infoBox("Link to " sLink " removed");
}
}
for (sLink in skNewLinks do {
if (!find(skOldLinks, sLink)) {
links += sLink "\n";
infoBox("Link to " sLink " added");
}
}
return links;
}
When I add an infoBox to the first 2 loops, I get exactly what I'm looking for (TCP_4470), but when I get to the 2nd set of loops, I'm getting the 9-digit number (357402608). It doesn't make sense to me why I would be able to add the correct value into the skipList, but not when I read from it. Can someone please tell me what I'm doing wrong?
Chris chrscote - Mon Jan 02 12:08:46 EST 2017 |
Re: Trouble displaying link ids Did not test your code, but a guess: the type for variable "sLink" is not set and DOORS determines the data type based on the data. Try adding "string sLink" to the beginning of your code. If that helps, then see the following thread on how to disable the DOORS DXL auto-declare https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014818071 |
Re: Trouble displaying link ids PekkaMakinen - Tue Jan 03 03:03:44 EST 2017 Did not test your code, but a guess: the type for variable "sLink" is not set and DOORS determines the data type based on the data. Try adding "string sLink" to the beginning of your code. If that helps, then see the following thread on how to disable the DOORS DXL auto-declare https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014818071 Adding "string sLink" to the code did it. I don't understand why since I'm putting the values into a string skip list, but it works fine now. Thanks. Chris |
Re: Trouble displaying link ids chrscote - Tue Jan 03 07:46:55 EST 2017 Adding "string sLink" to the code did it. I don't understand why since I'm putting the values into a string skip list, but it works fine now. Thanks. Chris The "String" in createString skip refers to the key item, not to the data. So the data of a createString skip can be of any type. The for loop for skips iterates over the data and in your case probably the first object it found had a object identifier without a prefix, e.g. "105". As that is an integer and the type for sLink was not defined DOORS decided that you are looking for integer data, not string (text). Just say no to Auto-Declare :-) |